//
//  TestTabbarController.m
//  testApp
//
//  Created by iMac on 2018/2/11.
//  Copyright © 2018年 iMac. All rights reserved.
//

#import "TestTabbarControllerAnother.h"

@interface TestTabbarControllerAnother ()

@end

@implementation TestTabbarControllerAnother


- (BOOL)shouldAutorotate {
    return [[self topViewController:self] shouldAutorotate];
}
- (UIViewController *)topViewController:(UIViewController *)controller {
    while (controller.presentedViewController) {
        controller = controller.presentedViewController;
    }
    if ([controller isKindOfClass:[UINavigationController class]]) {
        UINavigationController *nav = (UINavigationController *)controller;
        controller = nav.topViewController;
        [self topViewController:controller];
    }
    if ([controller isKindOfClass:[UITabBarController class]]) {
        UITabBarController *tab = (UITabBarController *)controller;
        controller = tab.selectedViewController;
        [self topViewController:controller];
    }
    return controller;
}
@end
